#include "CollisionMap.h"

CCollisionMap::CCollisionMap()
{
	this->ReadFileInputData();
}

CCollisionMap::~CCollisionMap()
{ }

//------------------------
//
//------------------------
bool CCollisionMap::GetMapStatus(int indexHeight, int indexWidth)
{
	switch (MAPDATA[MAPHEIGHT - indexHeight][indexWidth])
	{
	case 25:
		return true;
		break;
	case 30:
		return true;
		break;
	case 31:
		return true;
		break;
	case 32:
		return true;
		break;
	case 37:
		return true;
		break;
	case 54:
		return true;
		break;
	case 58:
		return true;
		break;
	default:
		return false;
		break;
	}
}

//-----------------------------------
//
//-----------------------------------
int CCollisionMap::GetTileNumber(int indexHeight, int indexWidth)
{
	return MAPDATA[MAPHEIGHT - indexHeight][indexWidth];
}

int CCollisionMap::FindTileNumber(int row, int column, int tileNumber)
{
	int rw = MAPHEIGHT - row;
	if (rw < 0 || rw >= MAPHEIGHT || column < 0 || column > MAPWIDTH)
		return -1;
	for (int i = rw; i < MAPHEIGHT; i++)
		if (MAPDATA[i][column] == tileNumber)
			return MAPHEIGHT - i;

	return -1;
}
